jQuery: Novice to Ninja by Earle Castledine Craig Sharkie

jQuery: Novice to Ninja by Earle Castledine Craig Sharkie

Author:Earle Castledine, Craig Sharkie
Language: eng
Format: mobi, epub, pdf
Publisher: SitePoint Pty. Ltd.
Published: 2012-08-16T04:00:00+00:00


Any errors that arise from the load operation will fire the error code, which will call load again … over and over until it succeeds. Is that a good idea? Probably not! If it has failed ten times in a row, it would seem unlikely to suddenly work the eleventh time around, so at some point we’re going to have to throw up our hands and say, “That’s it!” So to finesse this a little bit, we’ll make a couple of changes: first we’ll add a counter variable, which we’ll call attempts. Secondly, we’re going to be modifying the delay time on each request (we’ll see why soon), so we need to add a new method to reset everything to the initial values: chapter_06/12_ajax_error_handling/script.js (excerpt)

var GALLERY = {

delay: 1000,

attempts: 3,

reset: function() {

this.delay = 1000;

this.attempts = 3;

},

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.